package com.ruoyi.ring.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ring.domain.RingExerciseDetail;
import com.ruoyi.ring.mapper.RingExerciseDetailMapper;
import com.ruoyi.ring.service.IRingExerciseDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 锻炼详情Service业务层处理
 * 
 * @author liuwp
 * @date 2025-09-25
 */
@Service
public class RingExerciseDetailServiceImpl implements IRingExerciseDetailService 
{
    @Autowired
    private RingExerciseDetailMapper ringExerciseDetailMapper;

    /**
     * 查询锻炼详情
     * 
     * @param id 锻炼详情主键
     * @return 锻炼详情
     */
    @Override
    public RingExerciseDetail selectRingExerciseDetailById(Long id)
    {
        return ringExerciseDetailMapper.selectRingExerciseDetailById(id);
    }

    /**
     * 查询锻炼详情列表
     * 
     * @param ringExerciseDetail 锻炼详情
     * @return 锻炼详情
     */
    @Override
    public List<RingExerciseDetail> selectRingExerciseDetailList(RingExerciseDetail ringExerciseDetail)
    {
        return ringExerciseDetailMapper.selectRingExerciseDetailList(ringExerciseDetail);
    }

    /**
     * 根据业务主键查询一条记录：锻炼详情
     *
     * @param ringExerciseDetail 锻炼详情
     * @return 锻炼详情
     */
    @Override
    public RingExerciseDetail selectOneRingExerciseDetail(RingExerciseDetail ringExerciseDetail)
    {
        return ringExerciseDetailMapper.selectOneRingExerciseDetail(ringExerciseDetail);
    }

    /**
     * 新增锻炼详情
     * 
     * @param ringExerciseDetail 锻炼详情
     * @return 结果
     */
    @Override
    public int insertRingExerciseDetail(RingExerciseDetail ringExerciseDetail)
    {
        ringExerciseDetail.setCreateTime(DateUtils.getNowDate());
        ringExerciseDetail.setUserId(SecurityUtils.getUserId());
        return ringExerciseDetailMapper.insertRingExerciseDetail(ringExerciseDetail);
    }

    /**
     * 修改锻炼详情
     * 
     * @param ringExerciseDetail 锻炼详情
     * @return 结果
     */
    @Override
    public int updateRingExerciseDetail(RingExerciseDetail ringExerciseDetail)
    {
        ringExerciseDetail.setUpdateTime(DateUtils.getNowDate());
        return ringExerciseDetailMapper.updateRingExerciseDetail(ringExerciseDetail);
    }

    @Override
    public int updateRingExerciseDetailCondition(RingExerciseDetail ringExerciseDetail, RingExerciseDetail ringExerciseDetailCondition)
    {
                ringExerciseDetail.setUpdateTime(DateUtils.getNowDate());
        return ringExerciseDetailMapper.updateRingExerciseDetailCondition(ringExerciseDetail, ringExerciseDetailCondition);
    }

    /**
     * 批量删除锻炼详情
     * 
     * @param ids 需要删除的锻炼详情主键
     * @return 结果
     */
    @Override
    public int deleteRingExerciseDetailByIds(Long[] ids)
    {
        return ringExerciseDetailMapper.deleteRingExerciseDetailByIds(ids);
    }

    /**
     * 删除锻炼详情信息
     * 
     * @param id 锻炼详情主键
     * @return 结果
     */
    @Override
    public int deleteRingExerciseDetailById(Long id)
    {
        return ringExerciseDetailMapper.deleteRingExerciseDetailById(id);
    }

    /**
     * 条件删除锻炼详情
     *
     * @param ringExerciseDetail 锻炼详情
     * @return 结果
     */
    @Override
    public int deleteRingExerciseDetailByCondition(RingExerciseDetail ringExerciseDetail)
    {
        return ringExerciseDetailMapper.deleteRingExerciseDetailByCondition(ringExerciseDetail);
    }

}
